{include file="common:lay_header" / }
{include file="common:upload" / }
<body>
<form class="layui-form" action="" lay-filter="example">
    <div class="layui-form-item">
        <label class="layui-form-label">车型标题</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入车型标题" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选择车系</label>
        <div class="layui-input-inline">
            <select name="pid" lay-verify="required" lay-search="">
                <option value="">请选择</option>
                {volist name="cate" id="data"}
                <option value="{$data.id}">{$data.name}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选择座位</label>
        <div class="layui-input-inline">
            <select name="zuowei" lay-verify="required" lay-search="">
                <option value="">请选择</option>
                {volist name="seat" id="data"}
                <option value="{$data.value}">{$data.label}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选择驱动</label>
        <div class="layui-input-inline">
            <select name="qudong" lay-verify="required" lay-search="">
                <option value="">请选择</option>
                {volist name="drive" id="data"}
                <option value="{$data.value}">{$data.label}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选择价格</label>
        <div class="layui-input-inline">
            <select name="jiage" lay-verify="required" lay-search="">
                <option value="">请选择</option>
                {volist name="price" id="data"}
                <option value="{$data.value}">{$data.label}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item" pane="">
        <label class="layui-form-label">配置</label>
        <div class="layui-input-block">
            {volist name="configure" id = "item"}
            <input type="checkbox" name="peizhi[]" lay-skin="primary" title="{$item.label}" >
            {/volist}
        </div>
    </div>

    <div class="layui-form-item" pane="">
        <label class="layui-form-label">车型亮点</label>
        <div class="layui-input-block">
            {volist name="liang_dian" id = "item"}
            <input type="checkbox" name="liangdian[]" lay-skin="primary" title="{$item.label}">
            {/volist}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否热门</label>
        <div class="layui-input-block">
            <input type="radio" name="hot" value="0" title="否" checked="">
            <input type="radio" name="hot" value="1" title="是">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">热门推荐</label>
        <div class="layui-input-block">
            <input type="radio" name="tuijian" value="0" title="否" checked="">
            <input type="radio" name="tuijian" value="1" title="是">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排量</label>
        <div class="layui-input-block">
            <input type="text" name="pailiang" lay-verify="required" autocomplete="off" placeholder="请输入排量"  value="2.0T" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">功率</label>
        <div class="layui-input-block">
            <input type="text" name="gonglv" lay-verify="required" autocomplete="off" placeholder="请输入功率" value="155Kw/5000rpm" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">车速</label>
        <div class="layui-input-block">
            <input type="text" name="chesu" lay-verify="required" autocomplete="off" value="180Km/h" placeholder="请输入车速" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">发动机</label>
        <div class="layui-input-block">
            <input type="text" name="fadongji" lay-verify="required" autocomplete="off" value="M274 211马力 L4" placeholder="请输入发动机" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">变速箱</label>
        <div class="layui-input-block">
            <input type="text" name="biansuxiang" lay-verify="required" autocomplete="off" value="7速手自一体/9挡自动变速" placeholder="请输入变速箱" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排放标准</label>
        <div class="layui-input-block">
            <input type="text" name="biaozhun" lay-verify="required" autocomplete="off" value="国Ⅵ" placeholder="请输入排放标准" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">车身尺寸</label>
        <div class="layui-input-block">
            <input type="text" name="chicun" lay-verify="required" autocomplete="off" value="5375mm*1928mm*2080mm" placeholder="请输入车身尺寸" class="layui-input">
        </div>
    </div>
<!--    <div class="layui-form-item layui-form-text">-->
<!--        <label class="layui-form-label">简介</label>-->
<!--        <div class="layui-input-block">-->
<!--            <textarea placeholder="请输入内容" class="layui-textarea" name="intro"></textarea>-->
<!--        </div>-->
<!--    </div>-->
    <input type="hidden" name="intro" value="">

    <script type="text/javascript" src="/static/index/js/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="/ueditor/ueditor.all.min.js"></script>
    <script type="text/javascript" src="/ueditor/lang/zh-cn/zh-cn.js"></script>
    <div class="layui-form-item">
        <label class="layui-form-label">详情</label>
        <div class="layui-input-block">
            <textarea id="demo" style="display: block;" name="content"></textarea>
            <script type="text/javascript">
                UE.getEditor('demo',{initialFrameWidth:800,initialFrameHeight:300})
            </script>
        </div>
    </div>
    <div class="layui-upload">
        <label class="layui-form-label">图片上传【主图】</label>
        <button type="button" class="layui-btn" id="test1">上传图片</button>
        <div class="layui-upload-list">
            <img class="layui-upload-img" id="demo1" width="20%">
            <p id="demoText"></p>
        </div>
        <input type="hidden" id="test2" name="z_img">
    </div>

    <div class="layui-upload">
        <label class="layui-form-label">图片上传【外观图片】</label>
        <button type="button" class="layui-btn" id="test3">上传图片</button>
        <div class="layui-upload-list">
            <img class="layui-upload-img" id="demo2" width="20%">
            <p id="demoText1"></p>
        </div>
        <input type="hidden" id="test4" name="w_img">
    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
        </div>
    </div>
</form>


<script src="__LAYUI__/layui.js" charset="utf-8"></script>

<script>
    layui.use(['upload','form','layedit'], function(){
        var $ = layui.jquery
            ,upload = layui.upload
            ,form = layui.form
            ,layedit = layui.layedit;

        layedit.set({
            uploadImage: {
                url: '/admin/upload/layui_upload' //接口url
                ,type: 'post' //默认post
            }
        });

        //var index =  layedit.build('demo'); //建立编辑器;
        //普通图片上传
        one_upload(upload,$);
        one_upload_copy(upload,$)

        //监听提交
        form.on('submit(demo1)', function(data){

            let json_field = data.field;
            //json_field.content = layedit.getContent(index);
            let url = "{:url('create')}";
            let params = json_field;
            //console.log(params);
            _axios(url,params)
            return false;
        });
    });
</script>

</body>
</html>